/// @description Insert description here
// You can write your code in this editor
//var tmp;




if(dadouzi>0)
{
	dadouzi-=1;
	if(dadouzi==0)
	{
		audio_stop_sound(snd_music_wudi);
		audio_play_sound(snd_music_bgm,0,true);
	}
}
//***按键控制
if(keyboard_check(ord("W")))
{
	if(!scr_crash(0,-1))
	{
		dy=-1;
		dx=0;
		face=1;
	}
}
else
if(keyboard_check(ord("S")))
{
	if(!scr_crash(0,1))
	{
		dy=1;
		dx=0;
		face=3;
	}

}
else
if(keyboard_check(ord("A")))
{
	if(!scr_crash(-1,0))
	{
		dy=0;
		dx=-1;
		face=2;
	}
	
}
else
if(keyboard_check(ord("D")))
{
	if(!scr_crash(1,0))
	{
		dy=0;
		dx=1;
		face=0;
	}

}
//***坐标移动
x+=dx*psp;
y+=dy*psp;
//***碰撞检测
if(scr_crash(dx,dy))
{
	dx=0;
	dy=0;
}

//***动画控制
if(dx!=0||dy!=0)
{
	image_index+=0.2;	
}

//***方向控制
switch(face)
{
	case 0:sprite_index=spr_player_right;break;
	case 1:sprite_index=spr_player_up;break;
	case 2:sprite_index=spr_player_left;break;
	case 3:sprite_index=spr_player_down;break;
	
}
//边界控制
if(x<16)x=176;
if(x>176)x=16;
	
	
	